package com.zhanglu.fun.services.datacenter.forumpost;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhanglu.fun.services.datacenter.common.ResultResponse;
import com.zhanglu.fun.services.datacenter.entity.ForumPost;

import lombok.extern.slf4j.Slf4j;

/**
 * @author zhanglu
 */
@Service
@Slf4j
public class ForumPostService {
    @Autowired
    private ForumPostMapper forumPostMapper;

    public ResultResponse getForumPostsByThreadId(Long threadId) {
        return new ResultResponse<>(true, forumPostMapper.select(new ForumPost().setThreadId(threadId)));
    }

    public ResultResponse addForumPost(ForumPost post) {
        return new ResultResponse<>(forumPostMapper.insert(post) > 0, null);
    }
}
